package com.example.batterynotification;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.util.Log;



public class AboutBatteryFragment extends PreferenceFragment {


	  @Override
	public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        
	        // Load the preferences from an XML resource
	        addPreferencesFromResource(R.layout.about_battery);
	        
	        SharedPreferences sp = getPreferenceScreen().getSharedPreferences();
	        
	        Preference LevelPref = (Preference) findPreference("levelkey");
	        Preference statpref = (Preference)  findPreference("statekey");	
	        Preference srcPref = (Preference)  findPreference("chargingsourcekey");	
	        Preference tempPref = (Preference) findPreference("temperaturekey");
	        Preference voltPref = (Preference) findPreference("voltagekey");
	        Preference healthPref = (Preference) findPreference("healthkey");	        
	    
	        AboutBatteryPreferences.setLevelPreference(LevelPref);
	        AboutBatteryPreferences.setStatusPreference(statpref);
	        AboutBatteryPreferences.setChargingSourcePreference(srcPref);
	        AboutBatteryPreferences.setTemperaturePreference(tempPref);
	        AboutBatteryPreferences.setVoltagePreference(voltPref);
	        AboutBatteryPreferences.setHealthPreference(healthPref);
	        
	        Log.i("LC", "Batteryyyy" +BatteryReceiverForegroundResources.GetBatteryLevel() );
	        
	        LevelPref.setSummary(sp.getString("levelkey", BatteryReceiverForegroundResources.GetBatteryLevel() ));	        
	        statpref.setSummary(sp.getString("statekey", BatteryReceiverForegroundResources.GetBatteryState() ));	 
	        srcPref.setSummary(sp.getString("chargingsourcekey", BatteryReceiverForegroundResources.GetBatteryChargingSource() ));	 	
	        tempPref.setSummary(sp.getString("temperaturekey", BatteryReceiverForegroundResources.GetBatteryTemperature() ));	 	  	
	        voltPref.setSummary(sp.getString("voltagekey", BatteryReceiverForegroundResources.GetBatteryVoltage() ));	
	        healthPref.setSummary(sp.getString("healthkey", BatteryReceiverForegroundResources.GetBatteryHealth() ));		        
	        
	        
	  }


	   
	   
	  
}
